﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DVSProject.Models.ReportVisitModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    IndexView
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        รายงานการเยี่ยมลูกค้า</h2>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".date").datepicker({ dateFormat: 'dd-mm-yy' });
            //getter
            var dateFormat = $(".date").datepicker("option", "dateFormat");
            //setter
            $(".date").datepicker("option", "dateFormat", 'dd-mm-yy');
            $('.date').datepicker();

            $("#Search").click(function () {
                Search();
            });

            function Search() {
                var actionUrl = '<%=Url.Action("SearchVisitProcess","Access") %>'


                var checkFSRNo = $("#CheckFSRNo").val();
                var checkLocation = $("#CheckLocation").val();
                var checkVisitDate = $("#CheckVisitDate").val();
                alert($('#CheckFSRNo').val());
                //                $.ajax({
                //                    type: "GET",
                //                    url: actionUrl,
                //                    contentType: "application/json; charset=utf-8",
                //                    data: ({ isFitter: isFilter }),
                //                    success: function (data) {

                //                        $("#ResultRemarkII").html(data);

                //                        if (point < 3) {
                //                            $('#ResultRemarksII').removeAttr("disabled");
                //                        }
                //                    },
                //                    error: function (data) {
                //                        alert(data);
                //                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                //                    }
                //                });
            }
        });

          
    </script>
    <% using (Html.BeginForm())
       {%>
    <%= Html.ValidationSummary(true) %>
    <fieldset>
        <legend>เงื่อนไขรายงาน</legend>
        <div class="editor-label">
        </div>
        <div class="editor-field">
            <%-- <%=Html.CheckBoxFor(model=>model.CheckLocation,new { @class = ".ads_Checkbox" }) %>--%>
            Location :
            <%=Html.DropDownListFor(model => model.locationSetCode, Model.LocationSelects, "-Select All-")%>
        </div>
        <div class="editor-label">
        </div>
        <div class="editor-field">
            <%-- <%=Html.CheckBoxFor(model => model.CheckVisitDate, new { @class = ".ads_Checkbox" })%>--%>
            วันที่เซอร์วิส :
            <%= Html.TextBoxFor(model => model.start_date, new { @class = "date" })%>
            <%= Html.ValidationMessageFor(model => model.start_date)%>
            ถึง:
            <%= Html.TextBoxFor(model => model.end_date, new { @class = "date" })%>
            <%= Html.ValidationMessageFor(model => model.end_date)%>
        </div>
        <div class="editor-label">
        </div>
        <div class="editor-field">
        </div>
        <div class="editor-label">
            <%-- <%=Html.CheckBoxFor(model => model.CheckFSRNo, new { @class = ".ads_Checkbox" })%>--%>
            FSR No. :
            <%= Html.TextBoxFor(model => model.FSRNOText)%>
            <%= Html.ValidationMessageFor(model => model.FSRNOText)%>
        </div>
        <p>
            <input type="submit" value="Search" />
        </p>
    </fieldset>
    <% } %>
    <%if (Model.AccessList != null)
      {%>
    <div class="CSSTableGenerator">
        <table>
            <tr>
                <th>
                    View
                </th>
                <th>
                    หมายเลข
                </th>
                <th>
                    LocationSetCode
                </th>
                <th>
                    DateTimeIn
                </th>
                <th>
                    DateTimeOut
                </th>
                <th>
                    WorkType
                </th>
                <th>
                    SerialNo
                </th>
                <th>
                    Status
                </th>
                <th>
                    SignBy
                </th>
            </tr>
            <% foreach (var item in Model.AccessList)
               { %>
            <tr>
                <td>
                    <%= Html.ActionLink("View", "../ReportVisit/ViewReport", new { FSRNOText = item.FSR_NO  /* id=item.PrimaryKey */ }, new { target = "_blank" })%>
                </td>
                <td>
                    <%= Html.Encode(item.FSR_NO) %>
                </td>
                <td>
                    <%= Html.Encode(item.LocationSetCodeFullName)%>
                </td>
                <td>
                    <%= Html.Encode(item.DateTimeIn.ToString("dd/MM/yyy HH:mm"))%>
                </td>
                <td>
                    <%= Html.Encode(item.DateTimeOut.ToString("dd/MM/yyy HH:mm"))%>
                </td>
                <td>
                    <%= Html.Encode(item.WorkType) %>
                </td>
                <td>
                    <%= Html.Encode(item.MachineFullName) %>
                </td>
                <td>
                    <%= Html.Encode(item.Status) %>
                </td>
                <td>
                    <%= Html.Encode(item.SignBy)%>
                </td>
                <%--   <td>
                <%= Html.Encode(String.Format("{0:F}", item.PresentCount)) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:F}", item.PreviousCount)) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:F}", item.TotalCount)) %>
            </td>
            <td>
                <%= Html.Encode(item.Discount) %>
            </td>
            <td>
                <%= Html.Encode(item.ConversionRate) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:F}", item.TotalNoOfRacks)) %>
            </td>
            <td>
                <%= Html.Encode(item.SignBy) %>
            </td>--%>
            </tr>
            <% } %>
        </table>
    </div>
    <%} %>
</asp:Content>
